{extend name="base" /}
{block name="content"}
<div class="m-b-md">
    <h2 class="m-b-none">货品列表</h2>
</div>
<div class="row">
    <div class="col-sm-12">
        <section class="panel panel-default">
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th class="col-sm-1">货品ID</th>
                        <th>颜色</th>
                        <th>尺码</th>
                        <th>库存</th>
                        <th>货号</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="data" item="v"}
                        <tr>
                            <td class="col-sm-2">{$v['glid']}</td>
{foreach name="$v['combine']" item="vv"}
                            <td class="col-sm-2">{$vv['gtvalue']}</td>
{/foreach}
                            <td class="col-sm-2">{$v['stock']}</td>
                            <td class="col-sm-2">{$v['glnumber']}</td>
                            <td>
                                <div class="btn-group">
                                    <a href="{:url('admin/goodslist/edit',['glid'=>$v['glid'],'gid'=>input('param.gid')])}" class="btn btn-info">编辑</a>
                                    <a href="javascript:;" onclick="del({$v['glid']})" class="btn btn-danger" >删除</a>
                                </div>
                            </td>
                        </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
        </section>
    </div>
</div>
<div class="btn-group">
    <a href="{:url('admin/goodslist/add',['gid'=>input('param.gid')])}" class="btn btn-success">货品添加</a>
</div>
<script>
    function del(glid) {
        var obj = util.modal({
            title:'确认删除吗?',//标题

            content:'',//内容

            footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-danger confirm" data-dismiss="modal">删除</button>',//底部

            width:600,//宽度

            events:{
                confirm:function(){
                    //哪个元素上有.confirm类，被点击就执行这个回调
                    location.href = "{:url('del')}" + '?glid=' + glid;
                }
            }
        });
        //显示模态框
        obj.modal('show');
    }
</script>
{/block}